Add option to pad key columns on the left
authorjustbur <justin@burkett.cc>
Thu, 12 Nov 2015 18:23:59 +0000 (13:23 -0500)
committerjustbur <justin@burkett.cc>
Thu, 12 Nov 2015 18:28:33 +0000 (13:28 -0500)
Allows you to make more space between the columns if you think the
layout is too tight.

README.org
which-key.el

index 8e56c9dbcf60ee03e85c4a7623d4e098cf3ecb79..4a7a4e3daacedc953c7f1e33859c1b032c481116 100644 (file)
@@ -411,9 +411,13 @@ shown.
   (setq which-key-idle-delay 1.0) 
 
   ;; Set the maximum length (in characters) for key descriptions (commands or
-  ;; prefixes). Descriptions that are longer are truncated and have ".." added
+  ;; prefixes). Descriptions that are longer are truncated and have ".." added.
   (setq which-key-max-description-length 27)
 
+  ;; Use additonal padding between columns of keys. This variable specifies the
+  ;; number of spaces to add to the left of each column.
+  (setq which-key-add-column-padding 0)
+
   ;; Set the separator used between keys and descriptions. Change this setting to
   ;; an ASCII character if your font does not show the default arrow. The second
   ;; setting here allows for extra padding for Unicode characters. which-key uses
index f24f0d156dcceafbb79e393c9bcb14780581dc1b..d875ffff2eac72f6a7c267451a04385d89cc5383 100644 (file)
@@ -68,6 +68,12 @@ Also adds \"..\". If nil, disable any truncation."
   :group 'which-key
   :type 'integer)
 
+(defcustom which-key-add-column-padding 0
+  "Additional padding (number of spaces) to add to the left of
+each key column."
+  :group 'which-key
+  :type 'integer)
+
 (defcustom which-key-separator " → "
   "Separator to use between key and description."
   :group 'which-key
@@ -1258,7 +1264,8 @@ element in each list element of KEYS."
   "Take a column of (key separator description) COL-KEYS,
 calculate the max width in the column and pad all cells out to
 that width."
-  (let* ((col-key-width  (which-key--max-len col-keys 0))
+  (let* ((col-key-width  (+ which-key-add-column-padding
+                            (which-key--max-len col-keys 0)))
          (col-sep-width  (which-key--max-len col-keys 1))
          (col-desc-width (which-key--max-len col-keys 2))
          (col-width      (+ 1 col-key-width col-sep-width col-desc-width)))